package sy.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;

import sy.service.SysDivisionServiceI;
import sy.util.Tree;
import sy.util.ZtreeNode;

@Controller
@RequestMapping("divisionController")
public class DivisionController {
	
	private SysDivisionServiceI sysDivisionService;

	public SysDivisionServiceI getSysDivisionService() {
		return sysDivisionService;
	}

	@Autowired
	public void setSysDivisionService(SysDivisionServiceI sysDivisionService) {
		this.sysDivisionService = sysDivisionService;
	}
	
	/************************** view controller ***************************/
	
	/**
	 * 
	 * @Title      : objectView 
	 * @Description: TODO
	 * @param model
	 * @return     : String
	 * @author     :xieyuanqiuuu
	 * Create Date : 2017年7月27日 上午10:25:36
	 * @throws
	 */
	@RequestMapping(value="/view")
	public String objectView(){
		return "baseInfo/division/division"; 
	}
 
	/************************** data controller ***************************/
	
	/**
	 * 
	 * @Title		:getDivisionTree
	 * @Description	:TODO
	 * @param		:@return
	 * @return		:List<Tree>
	 * @author		:wujiayi
	 * @time		:2017年9月29日 上午10:33:27
	 * @throws
	 */
	@ResponseBody
	@RequestMapping(value = "/getDivisionTree", method = RequestMethod.POST)
	private List<Tree> getDivisionTree() {
		List<Tree> divisionTree = sysDivisionService.listSysDivisionTree();
		return divisionTree;
	}
	
	/**
	 * 
	 * @Title		:getDivisionZTree
	 * @Description	:TODO
	 * @param		:@return
	 * @return		:List<ZtreeNode>
	 * @author		:wujiayi
	 * @time		:2017年9月29日 上午10:33:37
	 * @throws
	 */
	@ResponseBody
	@RequestMapping(value = "/getDivisionZTree", method = RequestMethod.POST)
	private List<ZtreeNode> getDivisionZTree() {
		List<ZtreeNode> divisionZTree = sysDivisionService.listSysDivisionZTree();
		return divisionZTree;
	}
	
}
